package dao.jpa;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import dao.VendaDAO;
import entity.Venda;

@Repository
public class VendaJpaDAO extends GenericJpaDAO<Venda> implements VendaDAO,
		Serializable {

	private static final long serialVersionUID = -7769051838144785979L;

	@SuppressWarnings("unchecked")
	@Override
	public List<Venda> listarVendasPeriodo(Date dataInicial, Date dataFinal) {
		Criteria criteria = criarCriteria();

		return criteria.add(
				Restrictions.between("dataVenda", dataInicial, dataFinal))
				.list();
	}
}
